﻿using LostOrFind.Context;
using LostOrFind.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

namespace LostOrFind.APIs;
[ApiController]
[Route("api/[controller]")]
public class CategoryController : Controller
{
    private MyDbContext _dbContext;
    public CategoryController(MyDbContext dbContext)
    {
        _dbContext = dbContext;
    }

    [HttpGet]
    public async Task<IList<Category>> GetCategories()
    {
        return await _dbContext.Categories.ToListAsync();
    }
}